package com.atguigu.gmall.feign.search;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.search.entity.Goods;
import com.atguigu.gmall.search.vo.SearchParamVo;
import com.atguigu.gmall.search.vo.SearchRespVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;
import java.util.Objects;

/**
 * @author lfy
 * @Description
 * @create 2023-07-24 9:16
 */
@RequestMapping("/api/inner/search")
@FeignClient("service-search")
public interface SearchFeignClient {

    /**
     * 修改商品的热度分
     * @param skuId
     * @param score
     * @return
     */
    @GetMapping("/hotscore/{skuId}/{score}")
    Result incrHotScore(@PathVariable("skuId") Long skuId,
                               @PathVariable("score") Long score);

    /**
     * 检索
     * 远程返回的只是一个json而已，这个json随便feign-client自己怎么封装都行，只要是兼容的数据类型。
     * SearchRespVo == Map
     * @param searchParamVo
     * @return
     */
    @PostMapping("/search")
    Result<Map<String, Object>> search(@RequestBody SearchParamVo searchParamVo);
    /**
     * 上架
     * @param goods
     * @return
     */
    @PostMapping("/up")
    Result up(@RequestBody Goods goods);

    /**
     * 下架
     * @param skuId
     * @return
     */
    @GetMapping("/down/{skuId}")
    Result down(@PathVariable("skuId") Long skuId);

}
